<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html lang="en">
<head>
<title>媒体投放采购合同</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="icon" href="favicon.ico" type="image/x-icon" />
<!-- END META SECTION -->

<!-- CSS INCLUDE -->        
<link rel="stylesheet" href="${ctx}/rs/js/zTree/css/zTreeStyle/metro.css"/>
<link rel="stylesheet" href="${ctx}/rs/css/bootstrap-table.css" />
<link rel="stylesheet" href="${ctx}/rs/css/main.css" />
<link id="theme" rel="stylesheet" href="${ctx}/rs/joli/css/theme-default.css" />

<!-- EOF CSS INCLUDE -->        
</head>
<body>

	<!-- START PAGE CONTAINER -->
	<!-- 引入左菜单部分 -->

	<!-- START PAGE CONTENT -->

	<!-- START BREADCRUMB -->
	<!-- END BREADCRUMB -->


	<!-- PAGE CONTENT WRAPPER -->

	<div class="row">
		<div class="col-xs-12">
			<input type="hidden" id="contractCode" name="contractCode"
				value="${contractCode }">
			<table id="tablem" cellpadding="0" cellspacing="0" data-toggle="table"
				 data-url="${ctx}/contract/throwInfopage.htm"
				data-cache="false" data-pagination="true"
				data-side-pagination="server" data-page-list="[10, 20, 50, 100]"
				data-page-size="20" data-query-params="queryParamsm">
				<thead>
					<tr class="tab-th">
						<th data-field="buyCode" class="col-md-1">采购合同编号</th>
						<th data-field="extendMedia" class="col-md-2.5">推广媒体</th>
						<th data-field="advProduct" class="col-md-2.5">广告产品</th>
						<th data-field="sumSignMoney" class="col-md-1.5" data-formatter="moneyFormatter1">媒体投放金额</th>
						<th data-field="throwTime" class="col-md-2" data-formatter="timeFormatter1">投放期限</th>
						<th data-field="action" class="col-md-2" data-formatter="actionFormatter1">操作</th>
					</tr>
				</thead>
			</table>
		</div>
	</div>
	<!-- 引入所有joli的脚本 -->
	<!-- 引入页面需要的脚本 -->
	<script type="text/javascript" src="${ctx}/rs/js/qiao.js"></script>
	<script type="text/javascript" src="${ctx}/rs/js/bootstrapQ.min.js"></script>
	<script src="${ctx}/rs/js/jquery.formatDate.js"></script>
	<script src="${ctx}/rs/js/jquery.form.js" type="text/javascript"></script>
	<script src="${ctx}/rs/js/my97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="${ctx}/rs/js/session-out-error.js"></script>
	<script type="text/javascript">
    activeMenu($("#menu_contract_0"));
    var $tablem = $('#tablem');
    
    $tablem.on('click-row.bs.table', function (e, row, $element) {
          $tablem.bootstrapTable('uncheckAll');
          $tablem.bootstrapTable('check', $element.index());
    });
    
    $tablem.bootstrapTable({
        height: getHeight()
    });
      
    //获取分辨率高度
      function getHeight() {
          return window.screen.height - 308;
      }
      
      $(window).resize(function () {
      $tablem.bootstrapTable('resetView',{height: getHeight()});
    });
      
    //初始化刷新
   function refresh1(pageIndex,selectPage){
        if(!pageIndex && !selectPage){
            pageIndex = 0;
            selectPage = 0;
        }
        var key = encodeURIComponent($("#contractCode").val());
        var pageSize = $tablem.bootstrapTable('getOptions').pageSize;
        pageIndex=pageIndex*pageSize;
        $tablem.bootstrapTable('refresh', {
            silent: true,
            cache : false,
            url: '${ctx}/contract/buyList.htm',
            query: {
                key:key,
                pageIndex : pageIndex,
                pageSize : pageSize
            }
        });
        $tablem.bootstrapTable('selectPage', selectPage);
    }
   function queryParamsm(params) {
       var key = encodeURIComponent($("#contractCode").val());
       return {
           key:key,
           pageIndex : params.offset,
           pageSize : params.limit
       };
   }
   
    function timeFormatter1(value, row, index){
        if(value){
            var a = value.split("~");
            
            return a[0]+"<br/>"+"~"+a[1];
        }
        return "--";
   }
    function actionFormatter1(value, row, index){
    	var retbak="";
        if(row.throwUrl == null){
        	retbak='暂无已投方案';
        }else{
        retbak="<a href="+row.throwUrl+" download>下载已投方案</a>";
        }
        return retbak;
    }
   
    function moneyFormatter1(value, row, index){
    	if(value == null){
            value="0.00";
        }
        return "￥"+value.toFixed(2);
    }
    
    
  
    
    </script>
</body>
</html>
